GdkSegment
gdk_draw_rectangle
gdk_draw_polygon
-gdk_draw_glyphs
-gdk_draw_glyphs_transformed
gdk_draw_layout_line
gdk_draw_layout_line_with_colors
gdk_draw_layout
@n_points:
-<!-- ##### FUNCTION gdk_draw_glyphs ##### -->
-<para>
-
-</para>
-
-@drawable:
-@gc:
-@font:
-@x:
-@y:
-@glyphs:
-
-
-<!-- ##### FUNCTION gdk_draw_glyphs_transformed ##### -->
-<para>
-
-</para>
-
-@drawable:
-@gc:
-@matrix:
-@font:
-@x:
-@y:
-@glyphs:
-
-
<!-- ##### FUNCTION gdk_draw_layout_line ##### -->
<para>
</para>
<para>
Rendering a Pango layout is done most simply with gdk_draw_layout();
-you can also draw pieces of the layout with gdk_draw_layout() or
-gdk_draw_glyphs(). #GdkPangoRenderer is a subclass of #PangoRenderer
-that is used internally to implement these functions. Using it
-directly or subclassing it can be useful in some cases. See the
-#GdkPangoRenderer documentation for details.
+you can also draw pieces of the layout with gdk_draw_layout().
+#GdkPangoRenderer is a subclass of #PangoRenderer that is used internally
+to implement these functions. Using it directly or subclassing it can be
+useful in some cases. See the #GdkPangoRenderer documentation for details.
</para>
<example id="rotated-example">
<title>Using #GdkPangoRenderer to draw transformed text</title>
gdk_drawable_get_visual
gdk_drawable_set_colormap
gdk_draw_drawable
-gdk_draw_glyphs
-gdk_draw_glyphs_transformed
gdk_draw_line
gdk_draw_lines
gdk_draw_point
(GdkPoint *) points, n_points);
}
-static void
-real_draw_glyphs (GdkDrawable *drawable,
- GdkGC *gc,
- const PangoMatrix *matrix,
- PangoFont *font,
- gdouble x,
- gdouble y,
- PangoGlyphString *glyphs)
-{
- cairo_t *cr;
-
- cr = gdk_cairo_create (drawable);
- _gdk_gc_update_context (gc, cr, NULL, NULL, TRUE, drawable);
-
- if (matrix)
- {
- cairo_matrix_t cairo_matrix;
-
- cairo_matrix.xx = matrix->xx;
- cairo_matrix.yx = matrix->yx;
- cairo_matrix.xy = matrix->xy;
- cairo_matrix.yy = matrix->yy;
- cairo_matrix.x0 = matrix->x0;
- cairo_matrix.y0 = matrix->y0;
-
- cairo_set_matrix (cr, &cairo_matrix);
- }
-
- cairo_move_to (cr, x, y);
- pango_cairo_show_glyph_string (cr, font, glyphs);
-
- cairo_destroy (cr);
-}
-
-/**
- * gdk_draw_glyphs:
- * @drawable: a #GdkDrawable
- * @gc: a #GdkGC
- * @font: font to be used
- * @x: X coordinate of baseline origin
- * @y: Y coordinate of baseline origin
- * @glyphs: the glyph string to draw
- *
- * This is a low-level function; 99% of text rendering should be done
- * using gdk_draw_layout() instead.
- *
- * A glyph is a single image in a font. This function draws a sequence of
- * glyphs. To obtain a sequence of glyphs you have to understand a
- * lot about internationalized text handling, which you don't want to
- * understand; thus, use gdk_draw_layout() instead of this function,
- * gdk_draw_layout() handles the details.
- *
- **/
-void
-gdk_draw_glyphs (GdkDrawable *drawable,
- GdkGC *gc,
- PangoFont *font,
- gint x,
- gint y,
- PangoGlyphString *glyphs)
-{
- g_return_if_fail (GDK_IS_DRAWABLE (drawable));
- g_return_if_fail (GDK_IS_GC (gc));
-
- real_draw_glyphs (drawable, gc, NULL, font,
- x, y, glyphs);
-}
-
-/**
- * gdk_draw_glyphs_transformed:
- * @drawable: a #GdkDrawable
- * @gc: a #GdkGC
- * @matrix: (allow-none): a #PangoMatrix, or %NULL to use an identity transformation
- * @font: the font in which to draw the string
- * @x: the x position of the start of the string (in Pango
- * units in user space coordinates)
- * @y: the y position of the baseline (in Pango units
- * in user space coordinates)
- * @glyphs: the glyph string to draw
- *
- * Renders a #PangoGlyphString onto a drawable, possibly
- * transforming the layed-out coordinates through a transformation
- * matrix. Note that the transformation matrix for @font is not
- * changed, so to produce correct rendering results, the @font
- * must have been loaded using a #PangoContext with an identical
- * transformation matrix to that passed in to this function.
- *
- * See also gdk_draw_glyphs(), gdk_draw_layout().
- *
- * Since: 2.6
- **/
-void
-gdk_draw_glyphs_transformed (GdkDrawable *drawable,
- GdkGC *gc,
- const PangoMatrix *matrix,
- PangoFont *font,
- gint x,
- gint y,
- PangoGlyphString *glyphs)
-{
- g_return_if_fail (GDK_IS_DRAWABLE (drawable));
- g_return_if_fail (GDK_IS_GC (gc));
-
- real_draw_glyphs (drawable, gc, matrix, font,
- x / PANGO_SCALE, y / PANGO_SCALE, glyphs);
-}
-
static GdkDrawable *
gdk_drawable_real_get_composite_drawable (GdkDrawable *drawable,
gint x,
GdkPoint *points,
gint npoints);
- void (*draw_glyphs) (GdkDrawable *drawable,
- GdkGC *gc,
- PangoFont *font,
- gint x,
- gint y,
- PangoGlyphString *glyphs);
-
gint (*get_depth) (GdkDrawable *drawable);
void (*get_size) (GdkDrawable *drawable,
gint *width,
gint *composite_x_offset,
gint *composite_y_offset);
- void (*draw_glyphs_transformed) (GdkDrawable *drawable,
- GdkGC *gc,
- PangoMatrix *matrix,
- PangoFont *font,
- gint x,
- gint y,
- PangoGlyphString *glyphs);
-
cairo_surface_t *(*ref_cairo_surface) (GdkDrawable *drawable);
GdkDrawable *(*get_source_drawable) (GdkDrawable *drawable);
const GdkPoint *points,
gint n_points);
-void gdk_draw_glyphs (GdkDrawable *drawable,
- GdkGC *gc,
- PangoFont *font,
- gint x,
- gint y,
- PangoGlyphString *glyphs);
void gdk_draw_layout_line (GdkDrawable *drawable,
GdkGC *gc,
gint x,
const GdkColor *foreground,
const GdkColor *background);
-void gdk_draw_glyphs_transformed (GdkDrawable *drawable,
- GdkGC *gc,
- const PangoMatrix *matrix,
- PangoFont *font,
- gint x,
- gint y,
- PangoGlyphString *glyphs);
-
cairo_region_t *gdk_drawable_get_clip_region (GdkDrawable *drawable);
cairo_region_t *gdk_drawable_get_visible_region (GdkDrawable *drawable);
GdkPoint *points,
gint npoints);
-static void gdk_pixmap_draw_glyphs (GdkDrawable *drawable,
- GdkGC *gc,
- PangoFont *font,
- gint x,
- gint y,
- PangoGlyphString *glyphs);
-static void gdk_pixmap_draw_glyphs_transformed (GdkDrawable *drawable,
- GdkGC *gc,
- PangoMatrix *matrix,
- PangoFont *font,
- gint x,
- gint y,
- PangoGlyphString *glyphs);
-
static void gdk_pixmap_real_get_size (GdkDrawable *drawable,
gint *width,
gint *height);
drawable_class->draw_points = gdk_pixmap_draw_points;
drawable_class->draw_segments = gdk_pixmap_draw_segments;
drawable_class->draw_lines = gdk_pixmap_draw_lines;
- drawable_class->draw_glyphs = gdk_pixmap_draw_glyphs;
- drawable_class->draw_glyphs_transformed = gdk_pixmap_draw_glyphs_transformed;
drawable_class->get_depth = gdk_pixmap_real_get_depth;
drawable_class->get_screen = gdk_pixmap_real_get_screen;
drawable_class->get_size = gdk_pixmap_real_get_size;
gdk_draw_lines (private->impl, gc, points, npoints);
}
-static void
-gdk_pixmap_draw_glyphs (GdkDrawable *drawable,
- GdkGC *gc,
- PangoFont *font,
- gint x,
- gint y,
- PangoGlyphString *glyphs)
-{
- GdkPixmapObject *private = (GdkPixmapObject *)drawable;
-
- _gdk_gc_remove_drawable_clip (gc);
- gdk_draw_glyphs (private->impl, gc, font, x, y, glyphs);
-}
-
-static void
-gdk_pixmap_draw_glyphs_transformed (GdkDrawable *drawable,
- GdkGC *gc,
- PangoMatrix *matrix,
- PangoFont *font,
- gint x,
- gint y,
- PangoGlyphString *glyphs)
-{
- GdkPixmapObject *private = (GdkPixmapObject *)drawable;
-
- _gdk_gc_remove_drawable_clip (gc);
- gdk_draw_glyphs_transformed (private->impl, gc, matrix, font, x, y, glyphs);
-}
-
static void
gdk_pixmap_real_get_size (GdkDrawable *drawable,
gint *width,
GdkPoint *points,
gint npoints);
-static void gdk_window_draw_glyphs (GdkDrawable *drawable,
- GdkGC *gc,
- PangoFont *font,
- gint x,
- gint y,
- PangoGlyphString *glyphs);
-static void gdk_window_draw_glyphs_transformed (GdkDrawable *drawable,
- GdkGC *gc,
- PangoMatrix *matrix,
- PangoFont *font,
- gint x,
- gint y,
- PangoGlyphString *glyphs);
-
static cairo_surface_t *gdk_window_ref_cairo_surface (GdkDrawable *drawable);
static cairo_surface_t *gdk_window_create_cairo_surface (GdkDrawable *drawable,
int width,
drawable_class->draw_points = gdk_window_draw_points;
drawable_class->draw_segments = gdk_window_draw_segments;
drawable_class->draw_lines = gdk_window_draw_lines;
- drawable_class->draw_glyphs = gdk_window_draw_glyphs;
- drawable_class->draw_glyphs_transformed = gdk_window_draw_glyphs_transformed;
drawable_class->get_depth = gdk_window_real_get_depth;
drawable_class->get_screen = gdk_window_real_get_screen;
drawable_class->get_size = gdk_window_real_get_size;
END_DRAW;
}
-static void
-gdk_window_draw_glyphs (GdkDrawable *drawable,
- GdkGC *gc,
- PangoFont *font,
- gint x,
- gint y,
- PangoGlyphString *glyphs)
-{
- if (GDK_WINDOW_DESTROYED (drawable))
- return;
-
- BEGIN_DRAW;
- gdk_draw_glyphs (impl, gc, font,
- x - x_offset, y - y_offset, glyphs);
- END_DRAW;
-}
-
-static void
-gdk_window_draw_glyphs_transformed (GdkDrawable *drawable,
- GdkGC *gc,
- PangoMatrix *matrix,
- PangoFont *font,
- gint x,
- gint y,
- PangoGlyphString *glyphs)
-{
- PangoMatrix tmp_matrix;
-
- if (GDK_WINDOW_DESTROYED (drawable))
- return;
-
- BEGIN_DRAW;
-
- if (x_offset != 0 || y_offset != 0)
- {
- if (matrix)
- {
- tmp_matrix = *matrix;
- tmp_matrix.x0 -= x_offset;
- tmp_matrix.y0 -= y_offset;
- matrix = &tmp_matrix;
- }
- else if (GDK_PANGO_UNITS_OVERFLOWS (x_offset, y_offset))
- {
- PangoMatrix identity = PANGO_MATRIX_INIT;
-
- tmp_matrix = identity;
- tmp_matrix.x0 -= x_offset;
- tmp_matrix.y0 -= y_offset;
- matrix = &tmp_matrix;
- }
- else
- {
- x -= x_offset * PANGO_SCALE;
- y -= y_offset * PANGO_SCALE;
- }
- }
-
- gdk_draw_glyphs_transformed (impl, gc, matrix, font, x, y, glyphs);
-
- END_DRAW;
-}
-
static cairo_t *
setup_backing_rect (GdkWindow *window, GdkWindowPaint *paint, int x_offset_cairo, int y_offset_cairo)
{